import axios from 'axios';
import type { TableData } from '@arco-design/web-vue/es/table/interface';

export interface ContentDataRecord {
  x: string;
  y: number;
}

export function queryContentData() {
  return axios.get<ContentDataRecord[]>('/api/content-data');
}

export interface PopularRecord {
  key: number;
  clickNumber: string;
  title: string;
  increases: number;
}

export function queryPopularList(params: { type: string }) {
  return axios.get<TableData[]>('/api/popular/list', { params });
}

//文档管理
//文档列表
export function getdocList(data: any) {
  return axios.get('/doc/index', {
    params: data,
  });
}
// 文档详情
export function getdocdetail(data: any) {
  return axios.get('/doc/detail', {
    params: data,
  });
}
// 添加文档
export function adddoc(data: any) {
  return axios.post('/doc/add', data);
}
// 编辑文档
export function editDoc(data: any) {
  return axios.post('/doc/edit', data);
}
// 删除文档
export function deleteDoc(data: any) {
  return axios.post('/doc/delete', data);
}
// 文档锁定
export function lockDoc(data: any) {
  return axios.post('/doc/lock', data);
}
// 文档解锁
export function unlockDoc(data: any) {
  return axios.post('/doc/unlock', data);
}
// 文档移动
export function moveDoc(data: any) {
  return axios.post('/doc/move', data);
}

// 目录相关
// 目录列表
export function getdirList(data: any) {
  return axios.get('/doc_dir/index', {
    params: data,
  });
}
// 添加目录
export function addDir(data: any) {
  return axios.post('/doc_dir/add', data);
}
// 删除目录
export function deleteDir(data: any) {
  return axios.post('/doc_dir/delete', data);
}
// 文档目录详情
export function getDirDetail(data: any) {
  return axios.get('/doc_dir/detail', {
    params: data,
  });
}
// 编辑目录
export function editDir(data: any) {
  return axios.post('/doc_dir/edit', data);
}
// 目录移动
export function moveDir(data: any) {
  return axios.post('/doc_dir/move', data);
}
//目录归档
export function guiDir(data: any) {
  return axios.post('/doc_dir/archiving', data);
}

//目录分享
export function shareDir(data: any) {
  return axios.post('/doc_dir/share', data);
}

// 文档统计相关
// 文档类型饼状图
export function getEchartsEips(data: any) {
  return axios.get('/doc_statistics/pie', {
    params: data,
  });
}
// 文档类型柱状图
export function getEchartsabr(data: any) {
  return axios.get('/doc_statistics/bar', {
    params: data,
  });
}
// 部门文档数量柱状图
export function getEchartsDepts(data: any) {
  return axios.get('/doc_statistics/dept', {
    params: data,
  });
}
// 文档评论相关
export function getCommentList(data: any) {
  return axios.get('/doc_comment/index', {
    params: data,
  });
}
export function getCommitDetail(data: any) {
  return axios.get('/doc_comment/etail', {
    params: data,
  });
}
// 添加评论
export function addCommit(data: any) {
  return axios.post('/doc_comment/add', data);
}
// 删除评论
export function deleteCommit(data: any) {
  return axios.post('/doc_comment/delete', data);
}
